home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_sea_boat_endlevel.cog < prev    next >
Text File  |  1999-11-15  |  15KB  |  555 lines

  1. # Jones 3D Cog Script
  2. #
  3. # sea_boat_endlevel.cog
  4. #
  5. # [DS & revised by HB]
  6. #
  7. # (C) 1999 LucasArts Entertainment Company LLC. All Rights Reserved
  8. #
  9. # ==============================================================================
  10.  
  11. symbols
  12.  
  13.     message        startup
  14.     message        activate
  15.     message        entered
  16.     message        callback
  17.     message        timer
  18.  
  19. # ................................ KEYFRAMES ...................................
  20.  
  21.     keyframe    crankit=in_turn_crank2.key                local
  22.     keyframe    startcrnk=in_stand_bd_turn_crank2.key    local
  23.     keyframe    stopcrnk=in_turn_bd_stand_crank2.key    local
  24.     keyframe    boatin=0in_boat.key                        local
  25.     keyframe    crankmove=sea_hoist_crnk_wheel.key        local
  26.     keyframe    hoistmove=sea_hoist_crnk.key            local
  27.     keyframe    in_slide=in_whipclimb_idle.key            local
  28.  
  29. # ............................. INDY SAYLINES ..................................
  30.  
  31. # wrong item...
  32.     sound        in_itemline=Inxj089.wav                local # That didn't work.
  33.     sound        in_itemline1=Inxj090.wav            local # ...something wrong.
  34.     sound        in_itemline2=Inxj092.wav            local # Hmm...didn't quite work.
  35.     sound        in_itemline3=Inxj060.wav            local # I don't think...right answer.
  36.     sound        in_itemline4=Inxj087.wav            local # Whoops.
  37.     sound        in_itemline5=Inxj088.wav            local # Nope.
  38.     sound        in_itemline6=Inxj091.wav            local # Of course that didn't work.
  39.  
  40. # boat lines...    
  41.     sound        in_lowerlaunch=se06j01a.wav            local    # this launch...need to lower..
  42.     sound        in_dropwater=se06j02a.wav            local    # this boat...drop into water..
  43.  
  44. # hoist lines...
  45.     sound        in_wellook=Inxj232.wav                local # Well...look at this...
  46.     sound        in_important=Inxj233.wav            local # Hmm, this might be important.
  47.  
  48. # .............................. OTHER SOUNDS ..................................
  49.  
  50.     sound        attach=sea_launch_wheel_attach.wav        local
  51.     sound        takeoff=sea_launch_boat_takeoff.wav        local
  52.     sound        splash_snd=sea_launch_splash_c.wav        local
  53.     sound        boatstart=sea_launch_boat_start.wav        local
  54.     sound        wheelturn=sea_launch_wheel_turn.wav        local
  55.     sound        music0=mus_gen_indy_a_theme1.wav        local
  56.     sound        hoist_start=sea_hook_start_c.wav        local
  57.     sound        hoist_snd=sea_hook_move_c.wav            local
  58.     sound        hoist_stop=sea_hook_stop_c.wav            local
  59.  
  60. # .................................. THINGS ....................................
  61.  
  62.     thing        player                                    local
  63.     thing        camindy                                    local
  64.     thing        crank0                                    local
  65.     thing        hoistcam                                local
  66.     thing        campos0                                    nolink
  67.     thing        campos1                                    nolink
  68.     thing        campos2                                    nolink
  69.     thing        cam_tgt0                                nolink
  70.     thing        hoist_ct0                                nolink
  71.     thing        boat_cam0                                nolink
  72.     thing        boat_ct0                                nolink
  73.     thing        cam1spot                                nolink
  74.     thing        cam1lookspot                            nolink
  75.     thing        indyactor
  76.     thing        boat
  77.     thing        hoist
  78.     thing        crankpos                                nolink
  79.     thing        boatactor
  80.     thing        boattarg0                                nolink
  81.     thing        boattarg1                                nolink
  82.     thing        splash                                    nolink
  83.     thing        fader                                    nolink    # gen_fadeplat thing
  84.  
  85. # ....polyline and endpoints....
  86.  
  87.     thing        srcthing0                                nolink
  88.     thing        srcthing1                                nolink
  89.     thing        endhook0                                nolink
  90.     thing        endhook1                                nolink
  91.  
  92. # ........................... ENGINE & WORLD REFS ..............................
  93.     
  94.     cog            hintcog
  95.  
  96.     sector        seen_it
  97.     sector        camsector                                local # var
  98.  
  99.     template    crank
  100.     template    tpl_Indy=indy_actor                        local
  101.     template    tpl_ghost=ghost                            local
  102.  
  103.     material    cablemat=fhead_rope_sde.mat                local
  104.     material    splashmat=gen_a4sfx_splash.mat            local
  105.  
  106. # ................................ VARIABLES ...................................
  107.  
  108.     vector        v_cpos                                    local
  109.     vector        v_hlvec                                    local
  110.     vector        v_aimhi                                    local
  111.  
  112.     flex        randwrongitemlines                        local
  113.     flex        f_dotl                                    local
  114.     
  115.     int            boat_run                                local
  116.     int            boat_start                                local
  117.     int            playmusic                                local
  118.     int            crankn                                    local
  119.     int            crankn_w                                local
  120.     int            crankn_h                                local
  121.     int            active=0                                local
  122.     int            splush                                    local
  123.     int            wi_newline=50                            local
  124.     int            wi_oldline=50                            local
  125.     int            lineindex                                local # indexes sound array
  126.     int            in_track0                                local
  127.     int            in_track1                                local
  128.     int            curcam                                    local
  129.     int            sender                                    local
  130.     int            curitem=0                                local
  131.     int            sayhoist=0                                local
  132.     int            sayboat=0                                local
  133.     int            startit                                    local
  134.     int            moveit                                    local
  135.     int            stopit                                    local
  136.     int            speak0                                    local
  137.     int            lookhoisthappened=0                        local
  138.     int            spot                                    local
  139.  
  140.         cog                     SEA_Deck_AI
  141.  
  142. # ------ From Chris's Cog vol_boatmover.cog -----------------
  143. thing    boatringpos
  144. thing    boatring                                local
  145. template    ring=+ripples                        local
  146. vector    boatstart                              local
  147. vector    boatend                            local
  148. int        wake                                local
  149.  
  150.     
  151. end
  152.  
  153. # ================================================================================
  154.  
  155. code
  156.  
  157. # ..............................................................................
  158.  
  159. startup:
  160.  
  161.     player = GetLocalPlayerThing();
  162.     CreatePolylineThing(srcthing0, endhook0, '0 0 0', cablemat, .002, .002, 0);
  163.     CreatePolylineThing(srcthing1, endhook1, '0 0 0', cablemat, .002, .002, 0);
  164.     AttachThingToThing(endhook0, boat);
  165.     AttachThingToThing(endhook1, boat);    
  166.     SetThingFlags(splash, 0x80000);
  167.     SetThingAlpha(fader, 0.0);
  168.     SetThingLight(boat, '0.2 0.3 0.3', 0.01, 0.01);
  169.     global14=0;
  170.  
  171.     return;
  172.  
  173. # ..............................................................................
  174.  
  175. entered:
  176.  
  177.     #--has seen boat---
  178.     if(GetSenderRef() == seen_it)
  179.     {
  180.         global14=1;
  181.     }
  182.     return;
  183.  
  184. # ..............................................................................
  185.  
  186. activate:
  187.  
  188.     if (active == 1)
  189.     {
  190.         return;
  191.     }
  192.  
  193.     sender = GetSenderRef();
  194.     curitem = GetCurItem(player);
  195.  
  196.     #### curitem = 0; # TEMP TEST ONLY!!!
  197.  
  198.     if (sender == hoist && curitem == 113)
  199.     {
  200.         active = 1;
  201.         SendMessageEx(hintcog, user4, 1, 0, 0, 0); # param0=1; solved
  202.                 
  203.                 SendMessage(SEA_Deck_AI, user1);  //added by JM
  204.                 
  205.         MakeMeStop();
  206.         SetThingFlags(player, 0x80000);
  207.         SetActorFlags(player, 0x200000); # no control
  208.         CopyPlayerHolsters(player, indyactor);
  209.         startcutscene(1);
  210.         AttachThingToThing(fader, campos2);
  211.         ClearThingFlags(indyactor, 0x80000);
  212.         
  213.         # Shot of Indy at the crankwheel post...
  214.         SetCameraFocus(2, campos0);
  215.         SetCameraSecondaryFocus(2, hoist_ct0);
  216.         SetCameraLookInterp(2, 0);
  217.         SetCameraPosInterp(2, 0);
  218.         SetCurrentCamera(2);
  219.         SetCameraFOV(60, 0, 0.0);
  220.         PlayMode(indyactor, 60, 0);
  221.         Sleep(0.5);
  222.  
  223.         crank0=CreateThing(crank, crankpos);
  224.         CaptureThing(crank0);
  225.         PlaySoundThing(attach, crank0, 1.0, 5, 20, 0);
  226.         Sleep(0.5);
  227.  
  228.         PlayKey(indyactor, startcrnk, 4, 0x12, 1);
  229.         crankn = PlayKey(indyactor, crankit, 4, 0x10, 0);
  230.         crankn_w = PlayKey(crank0, crankmove, 4, 0x10, 0);
  231.         crankn_h = PlayKey(hoist, hoistmove, 4, 0x10, 0);
  232.         Sleep(2.3);
  233.  
  234.         # Cut to shot of boat descending into water...
  235.         AttachThingToThing(cam_tgt0, boat);
  236.         SetCameraFocus(2, campos1);
  237.         SetCameraSecondaryFocus(2, cam_tgt0);
  238.         startit = PlaySoundThing(hoist_start, hoist, 1, 10, 30, 0);
  239.         WaitForSound(startit);
  240.         
  241.         # Down boat...
  242.         MoveToFrame(boat, 1, 1.0);
  243.         moveit = PlaySoundThing(hoist_snd, hoist, 1, 10, 30, 1);
  244.         WaitforStop(boat);
  245.         PlaySoundThing(splash_snd, splash, 1.0, 15, 30, 0);
  246.         SetThingLight(splash, '0.2 0.3 0.3', 0.01, 0.01);
  247.         ClearThingFlags(splash, 0x80000);
  248.         splush=MaterialAnim(splashmat, 8.0, 0);
  249.  
  250.         # Indy slides down aft polyline...
  251.         StopKey(indyactor, crankn, 0.0);
  252.         StopKey(crank0, crankn_w, 0.0);
  253.         StopKey(hoist, crankn_h, 0.0);
  254.         Sleep(0.5);
  255.         ClearPhysicsFlags(indyactor, 0x01); # no gravity
  256.         TelePortThing(indyactor, srcthing1);
  257.         in_track0 = PlayKey(indyactor, in_slide, 4, 0x10, 0);
  258.         MoveThingToPos(indyactor, GetThingPos(endhook1), 2.0);
  259.  
  260.         # TO DO:  add some rings after the splash...
  261.  
  262.         WaitForAnimStop(splush);
  263.         DestroyThing(splash);
  264.         DetachThing(endhook0);
  265.         DetachThing(endhook1);
  266.         DetachThing(cam_tgt0);
  267.         Stopsound(moveit, 0.1);
  268.         stopit = PlaySoundThing(hoist_stop, hoist, 1.0, 5, 20, 0);
  269.         Sleep(1.5);
  270.         StopKey(indyactor, in_track0, 0.0);
  271.  
  272.     #    DestroyThing(Boat);
  273.         SetThingFlags(Boat, 0x80000);
  274.     
  275.         DestroyThing(indyactor);
  276.         SetThingLight(boatactor, '0.3 0.4 0.4', 0.01, 0.01);
  277.         ClearThingFlags(boatactor, 0x80000);
  278.         AttachThingToThing(cam_tgt0, boatactor);
  279.  
  280.         # Cut to shot of Indy in the boat...
  281.         SetCameraFocus(2, campos2);
  282.         SetCameraSecondaryFocus(2, cam_tgt0);
  283.         SetCameraFOV(40, 0, 0.0);
  284.         PlayKey(boatactor, boatin, 4, 0x10, 0);
  285.         playmusic = PlaySoundLocal(music0, 1.0, 0.0, 0x0, 0);
  286.  
  287.         AttachThingToThing(boatringpos, boatactor);
  288.         SetTimer(0.1);
  289.  
  290.         Sleep(0.4);
  291.         boat_start=PlaySoundThing(boatstart, boatactor, 1.0, 55, 100, 0);
  292.         sleep(0.1);
  293.  
  294.         # Indy is free...
  295.         boat_run=PlaySoundThing(takeoff, boatactor, 1.0, 45, 100, 0x0081);
  296.         SetThingMaxRotVel(boatactor, 25);
  297.         AISetMoveSpeed(boatactor, 1.5);
  298.         AISetLookThing(boatactor, boattarg0);
  299.         AISetMoveThing(boatactor, boattarg0, 0);
  300.         SetCameraFOV(20, 1, 1.5);
  301.         Sleep(0.2);
  302.         AISetMoveSpeed(boatactor, 2.0);
  303.         Sleep(0.3);
  304.         AISetMoveSpeed(boatactor, 2.5);
  305.         Sleep(0.5);
  306.         AISetMoveSpeed(boatactor, 3.0);
  307.         Sleep(0.5);
  308.         AISetMoveSpeed(boatactor, 3.5);
  309.  
  310.         # Boom up to watch boat escape...
  311.         MoveToFrame(campos2, 1, 0.71);
  312.         SetCameraFOV(100, 1, 10.0);
  313.         Sleep(0.5);
  314.         AISetMoveSpeed(boatactor, 4.0);
  315.         AISetLookThing(boatactor, boattarg1);
  316.         AISetMoveThing(boatactor, boattarg1, 1);
  317.  
  318.         # Fade out...
  319.         ChangeSoundVol(playmusic, 0.0, 2.0);
  320.         ChangeSoundVol(boat_run, 0.0, 2.0);
  321.         ThingFadeAnim(fader, 0.0, 1.0, 1.0, 0); # fade out in 1 sec!
  322.         Sleep(2.0);
  323.         SetCameraLookInterp(2, 0);            #reset default
  324.         ResetCameraFOV(0, 0.0);                #reset default
  325.         SetCameraInterpSpeed(2, 1);            #reset default
  326.         active = 0;
  327.         endcutscene();
  328.         JonesEndLevel();                    # On to the next level
  329.     }
  330.  
  331.     if (sender == hoist && curitem != 113)
  332.     {
  333.         # Has seen boat...    
  334.         global14=1;
  335.  
  336.         active = 1;
  337.         MakeMeStop();
  338.         DeselectWeaponWait(player);
  339.         StartCutScene(1);
  340.  
  341.         # Locate player...
  342.         spot = 0;
  343.         v_hlvec = GetThingLVec(hoist);
  344.         v_aimhi = VectorSub((GetThingPos(hoist)), (GetThingPos(player)));
  345.         f_dotl = VectorDot(VectorNorm(v_aimhi), v_hlvec);
  346.         if (f_dotl > 0)
  347.         {
  348.             spot = 1; # outboard
  349.         }
  350.         
  351.         # prep
  352.         if (lookhoisthappened != 0)
  353.         {
  354.             DestroyThing(camindy);
  355.             DestroyThing(hoistcam);
  356.         }
  357.         camindy = CreateThing(tpl_Indy, player);
  358.         CaptureThing(camindy);
  359.         ClearThingFlags(camindy, 0x80000);
  360.         SetCollideType(camindy, 0);
  361.         CopyPlayerHolsters(player, camindy);
  362.         SetThingFlags(player, 0x80000);
  363.         AISetLookThing(camindy, hoist);
  364.         AIWaitForStop(camindy);
  365.         if (spot == 0)
  366.         {
  367.             v_cpos =
  368.             VectorAdd(VectorTransformToOrient(camindy, '-0.2 0.05 0.15'), GetThingPos(player));
  369.         }
  370.         else
  371.         {
  372.             v_cpos =
  373.             VectorAdd(VectorTransformToOrient(camindy, '0.2 0.05 0.15'), GetThingPos(player));
  374.         }
  375.         camsector = FindNewSectorFromThing(camindy, v_cpos);
  376.         hoistcam = CreateThingAtPos(tpl_ghost, camsector, v_cpos, '0 0 0');
  377.         CaptureThing(hoistcam);
  378.         lookhoisthappened = 1;
  379.         
  380.         # Set cam...
  381.         curcam = GetCurrentCamera();
  382.         MakeCamera2LikeCamera1(cam1spot, cam1lookspot);
  383.         SetCameraFocus(2, cam1spot);
  384.         SetCameraSecondaryFocus(2, cam1lookspot);
  385.         SetCurrentCamera(2);
  386.         ResetCameraFOV(0, 0.0);
  387.         SetCameraLookInterp(2, 1);
  388.         SetCameraPosInterp(2, 1);
  389.         SetCameraInterpSpeed(2, 0.7);
  390.         Sleep(0.01);
  391.         SetCameraFocus(2, hoistcam);
  392.         SetCameraSecondaryFocus(2, hoist);
  393.         Sleep(0.7);
  394.  
  395.         # player is using a wrong item
  396.         if (curitem >= 1)
  397.         {
  398.             PlayMode(player, 60, 0);
  399.             call randwrongitemlines;
  400.         }
  401.         else
  402.         {
  403.             # player isn't using anything
  404.             if (sayhoist == 0)
  405.             {
  406.                 speak0 = PlayVoice(player, in_wellook, 1.0, 0);
  407.             }
  408.             else
  409.             {
  410.                 speak0 = PlayVoice(player, in_important, 1.0, 0);
  411.             }
  412.             sayhoist = 1;
  413.         }
  414.         WaitForSound(speak0);
  415.  
  416.         # Clean up...
  417.         SetCameraLookInterp(2, 0);
  418.         SetCameraPosInterp(2, 0);
  419.         SetCameraPosition(1, GetThingPos(hoistcam));
  420.         SetCurrentCamera(curcam);
  421.         ResetCameraFOV(0, 0.0);
  422.         SetThingFlags(camindy, 0x80000);
  423.         ClearThingFlags(player, 0x80000);
  424.         EndCutscene();
  425.  
  426.         ClearActorFlags(player, 0x200000);
  427.         active = 0;
  428.     }
  429.  
  430.     if (sender == boat)
  431.     {
  432.         # Has seen boat...    
  433.         global14=1;
  434.  
  435.         active = 1;
  436.         MakeMeStop();
  437.         DeselectWeaponWait(player);
  438.         StartCutScene(1);
  439.  
  440.         # Set cam...
  441.         curcam = GetCurrentCamera();
  442.         MakeCamera2LikeCamera1(cam1spot, cam1lookspot);
  443.         SetCameraFocus(2, cam1spot);
  444.         SetCameraSecondaryFocus(2, cam1lookspot);
  445.         SetCurrentCamera(2);
  446.         ResetCameraFOV(0, 0.0);
  447.         SetCameraLookInterp(2, 1);
  448.         SetCameraPosInterp(2, 1);
  449.         SetCameraInterpSpeed(2, 0.7);
  450.         Sleep(0.01);
  451.         SetCameraFocus(2, boat_cam0);
  452.         SetCameraSecondaryFocus(2, boat_ct0);
  453.         Sleep(0.7);
  454.         
  455.         # player is using a wrong item
  456.         if (GetCurItem(player) >= 1)
  457.         {
  458.             PlayMode(player, 60, 0);
  459.             call randwrongitemlines;
  460.         }
  461.         else
  462.         {
  463.             # player isn't using anything
  464.             if (sayboat == 0)
  465.             {
  466.                 speak0 = PlayVoice(player, in_lowerlaunch, 1.0, 0);
  467.             }
  468.             else
  469.             {
  470.                 speak0 = PlayVoice(player, in_dropwater, 1.0, 0);
  471.             }
  472.             sayboat = 1;
  473.         }
  474.         WaitForSound(speak0);
  475.  
  476.         # Clean up...
  477.         SetCameraLookInterp(2, 0);
  478.         SetCameraPosInterp(2, 0);                
  479.         SetCameraPosition(1, GetThingPos(boat_cam0));
  480.         SetCurrentCamera(curcam);
  481.         ResetCameraFOV(0, 0.0);
  482.  
  483.         EndCutScene();
  484.         ClearActorFlags(player, 0x200000);
  485.         active = 0;
  486.     }
  487.  
  488.     return;
  489.  
  490. # ..............................................................................
  491.  
  492. callback:
  493.  
  494.     if (GetParam(1) == 16)
  495.     {
  496.         PlaySoundThing(wheelturn, crank0, 1.0, -1, -1, 0x0);
  497.     }
  498.  
  499.     return;
  500.  
  501. # ..............................................................................
  502.  
  503. randwrongitemlines:
  504.  
  505.     while (wi_newline == wi_oldline)
  506.     {        
  507.         wi_newline = RandBetween(0, 19);
  508.         if (wi_newline < 15)
  509.         {    
  510.             wi_newline = RandBetween(0, 3); # ~1/5 chance for lines 0 thru 3
  511.         }
  512.         if (wi_newline == 19)
  513.         {
  514.             wi_newline = 6; # 1/20 chance for line 6 
  515.         }
  516.         if (wi_newline > 16)
  517.         {
  518.             wi_newline = 5; # 1/10 chance for line 5 
  519.         }
  520.         if (wi_newline > 14)
  521.         {
  522.             wi_newline = 4; # 1/10 chance for line 4
  523.         }
  524.     }
  525.     wi_oldline = wi_newline;
  526.     speak0 = PlayVoice(player, in_itemline[wi_newline], 1, 0);
  527.  
  528.     return;
  529.  
  530. # ..............................................................................
  531. timer:
  532.         boatstart    = VectorSet(0.25, 0.25, 0.7);
  533.         boatend    = VectorSet(0.6, 0.6, 0.0);
  534.  
  535.         wake=randbetween(0, 4);
  536.         if(wake == 4)
  537.         {
  538.         setTimer(0.1);    
  539.         return;
  540.         }
  541.         # water rings at the base of the boat
  542.         boatring = CreateThing(ring, boatringpos);
  543.         CaptureThing(boatring);
  544.         AnimateSpriteSize(boatring, boatstart, boatend, 1.5);
  545.         SetTimer(0.1);
  546.         return;
  547.  
  548. end
  549.  
  550.  
  551.  
  552.  
  553.  
  554.  
  555.